home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / June 96 / Re ODF R1 RefCounting Extensio < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  1.6 KB  |  [TEXT/ttxt]

  1. Subject:     Re:ODF R1 RefCounting Extensio
  2. Sent:        6/1/96 8:34 AM
  3. Received:    6/3/96 7:58 AM
  4. From:        Greg Friedman, friedman@cognosis.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. At 4:32 PM 5/30/96, Kirk Swenson wrote:> In ODF R1, calling
  9. FW_CExtensionManager::AcquireExtension() for our extension
  10. > never Acquire()'s the extension if it has to create it, so the refcount
  11. > remains 0, and a subsequent Release() leads to a warning from OpenDoc.
  12.  
  13. Correctly initialized extensions begin life with a reference count of 1.
  14. Every extension should have a uniquely named "Init" method. When you create
  15. your extension, you should call the extension's Init method. Your custom
  16. Init method should, in addition to performing any specific initializations,
  17. call the Init method of your direct base. If you are directly subclassing
  18. ODExtension, you should call ODExtension::Init.
  19.  
  20. ODExtension derives from ODRefCntObject. ODExtension::Init calls
  21. ODRefCntObject::Init, which sets the reference count of the extension to 1.
  22.  
  23. You should also be sure to override Release in your custom extension and
  24. implement the following logic:
  25.  
  26.      FW_Boolean isValid = somSelf->IsValid(ev);
  27.      FW_OSemanticInterface_parent_ODSemanticInterface_Release(somSelf,ev);
  28.  
  29.      if (!isValid && somSelf->GetRefCount(ev) == 0)
  30.           delete somSelf;
  31.  
  32. This code handles the case where the extension's reference count is
  33. dropping to zero, and the base has been removed.
  34.  
  35. gsf.
  36.  
  37.  
  38.  
  39.  
  40. _________________________________________________________
  41. Greg Friedman      ODF Engineering       Apple Computer
  42.  
  43.